﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="valueedit.aspx.cs" Inherits="StoreWeb.system.basis.valueedit" %>

<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <!--[if lt IE 9]>
<script type="text/javascript" src="../../lib/html5.js"></script>
<script type="text/javascript" src="../../lib/respond.min.js"></script>
<script type="text/javascript" src="../../lib/PIE_IE678.js"></script>
<![endif]-->
    <link href="../../css/H-ui.min.css" rel="stylesheet" type="text/css" />
    <link href="../../css/H-ui.admin.css" rel="stylesheet" type="text/css" />
    <link href="../../css/style.css" rel="stylesheet" type="text/css" />
    <link href="../../lib/Hui-iconfont/1.0.1/iconfont.css" rel="stylesheet" type="text/css" />
    <!--[if IE 6]>
<script type="text/javascript" src="lib/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
    <title>编辑增值选项</title>
</head>
<body>
    <div class="pd-20">
        <form runat="server" method="post" class="form form-horizontal" id="formmemberadd">
            <div class="row cl">
                <label class="form-label col-2">所属类型：</label>
                <div class="formControls col-6">
                    <span class="select-box">
                        <asp:DropDownList ID="ddlisttype" CssClass="select" runat="server">
                            <asp:ListItem Value="1">通用增值</asp:ListItem>
                            <asp:ListItem Value="2">分类增值</asp:ListItem>
                        </asp:DropDownList>
                    </span>
                </div>
            </div>
            <div class="row cl" style="display: none" id="cklist">
                <label class="form-label col-2">所属分类：</label>
                <div class="formControls col-6">
                    <asp:RadioButtonList ID="ckboxlist" runat="server" RepeatDirection="Horizontal" RepeatColumns="4"></asp:RadioButtonList>
                </div>
            </div>
            <%--<div class="row cl">
                <label class="form-label col-2">上级属性：</label>
                <div class="formControls col-6">
                    <span class="select-box">
                        <asp:DropDownList ID="parentlist" CssClass="select" runat="server"></asp:DropDownList>
                    </span>
                </div>
                <div class="col-4">（不选默认主分类）</div>
            </div>--%>
            <div class="row cl" style="display:none;">
                <label class="form-label col-2"><span class="c-red">*</span>属性代码：</label>
                <div class="formControls col-6">
                    <input type="text" class="input-text" value="" placeholder="请填写属性代码" id="code" name="code" runat="server" datatype="*" nullmsg="属性代码不能为空">
                </div>
                <div class="col-4"></div>
            </div>
            <div class="row cl">
                <label class="form-label col-2"><span class="c-red">*</span>增值说明：</label>
                <div class="formControls col-6">
                    <input type="text" class="input-text" value="" placeholder="请填写属性名称" id="name" name="name" runat="server" datatype="*" nullmsg="属性名称不能为空">
                </div>
                <div class="col-4"></div>
            </div>
            <div class="row cl">
                <label class="form-label col-2">属性类型：</label>
                <div class="formControls col-6">
                    <asp:RadioButtonList ID="rdoistext" runat="server" name="rdobtnbuy" RepeatDirection="Horizontal" Style="width: 150px;">
                        <asp:ListItem Value="0">下拉选项</asp:ListItem>
                        <asp:ListItem Value="1">文本</asp:ListItem>
                    </asp:RadioButtonList>
                </div>
                <div class="col-4"></div>
            </div>
            <div class="row cl" id="showvalue">
                <label class="form-label col-2"><span class="c-red">*</span>属性值：</label>
                <div class="formControls col-6">
                    <textarea class="input-text" cols="20" rows="2" style="height:50px;" placeholder="请填写属性值" id="value" name="value" runat="server"></textarea>
                </div>
                <div class="col-4">（多个用英文逗号隔开）</div>
            </div>


            <div class="row cl" style="display:none;">
                <label class="form-label col-2">备注：</label>
                <div class="formControls col-6">
                    <input type="text" class="input-text" value="" placeholder="选填" id="note" name="note" runat="server">
                </div>
            </div>
            <div class="row cl">
                <div class="col-10 col-offset-2">
                    <asp:HiddenField ID="hidid" runat="server" />
                    <asp:Button ID="btnok" runat="server" CssClass="btn btn-success radius" Text="确定" />
                </div>
            </div>
        </form>
    </div>
    <script type="text/javascript" src="../../lib/jquery/1.9.1/jquery.min.js"></script>
    <script type="text/javascript" src="../../lib/layer/1.9.3/layer.js"></script>
    <script type="text/javascript" src="../../lib/Validform/5.3.2/Validform.min.js"></script>
    <script type="text/javascript" src="../../lib/laypage/1.2/laypage.js"></script>
    <script type="text/javascript" src="../../lib/My97DatePicker/WdatePicker.js"></script>
    <script type="text/javascript" src="../../js/H-ui.js"></script>
    <script type="text/javascript" src="../../js/H-ui.admin.js"></script>
    <script>
        $(function () {

            if ($("input[name='rdoistext']:checked").val() == "0") {
                $("#showvalue").show();
            } else {
                $("#showvalue").hide();
            }
            $("#rdoistext").change(function () {
                if ($("input[name='rdoistext']:checked").val() == "0") {
                    $("#showvalue").show();
                } else {
                    $("#showvalue").hide();
                }
            });
            if ($("#ddlisttype").val() == "2") {
                $("#cklist").show();
            } else {
                $("#cklist").hide();
            }
            $("#ddlisttype").change(function () {
                if ($(this).val() == "2") {
                    $("#cklist").show();
                } else {
                    $("#cklist").hide();
                }
            }); 
            $("#formmemberadd").Validform({
                tiptype: 2,
                btnSubmit: "#btnok",
                //callback: function (form) {
                //    form[0].submit();
                //    var index = parent.layer.getFrameIndex(window.name);
                //    parent.$('.btn-refresh').click();
                //    parent.layer.close(index);
                //}
                //,
                beforeSubmit: function (curform) {
                    var valuelist = ""; //保存checkbox选中值
                    //遍历name以listTest开头的checkbox
                    $("input[name^='ckboxlist']").each(function () {
                        if (this.checked) {
                            //$(this):当前checkbox对象;
                            //$(this).parent("span"):checkbox父级span对象
                            if (valuelist == "") {
                                valuelist = $(this).val();
                            } else {
                                valuelist += "|" + $(this).val();
                            }
                        }
                    });
                    $.post("../../ajax/value.aspx", { vtype: $("#ddlisttype").val(), code: $("#code").val(), parentlist: $("input[name='rdoistext']:checked").val(), value: $("#value").val(), name: $("#name").val(), note: $("#note").val(), id: $("#hidid").val(), cInvCCodes: valuelist },
                    function (data) {
                        if (data == 1) {
                            parent.layer.alert("添加成功", function () {
                                parent.location.reload();
                            });
                        } else if (data == 2) {
                            parent.layer.alert("修改成功", function () {
                                parent.location.reload();
                            });
                        } else {
                            parent.layer.msg("操作失败");
                        }
                    });
                    return false;
                }
            });
        });
    </script>
</body>
</html>
